{"componentChunkName":"component---node-modules-gatsby-theme-chronoblog-src-templates-post-js","path":"/2022-1-24-setup-ssl/","result":{"data":{"mdx":{"id":"c662d9bd-16a0-59d9-aaff-903dd8350216","excerpt":"Let's Encrypt is a Certificate Authority which allows you obtain and install free TLS/SSL certificates. Certbot from Let's Encrypt automates…","frontmatter":{"title":"Setting up SSL on Server","date":"2022-01-24T00:00:00.000Z","description":"We'll set up a SSL Certificate on the server with Let's Encrypt","tags":["Nginx","DigitalOCean","SSL","Let's Encrypt","Ubuntu"],"cover":{"childImageSharp":{"fluid":{"base64":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAIAAADwazoUAAAACXBIWXMAAAsTAAALEwEAmpwYAAABb0lEQVQoz2P4TxT4+//fn////6GJMuDVA1L978fbvz8//H155O+vT/9/fYCLo2v+9w+IQMSfv3+B6O+/v3+Bop/v/H+6/v/Nzv/Pt/7/8QqnZph+hLX/f3/8/ezAswOl9zbHvzre9O/Vsf9/f6E7+x9Yx4u3nzYevvzr9587T17vPHFj2a6ztx6/unznsVpwpXnqRPP4hvefvsAVo2u+/+xt28LdM9Yf9SicEdO4ZNnucxldqzYducppVagX3iLhWvXm41dQ6GHV/PX7z6JJG+ZvPXnl3vPbj18/evn+1LVHj1++X7H77NS1h1fsOfvq/WecNj9789G/fO7SXWca5u6Ytu7IrI3Hpq8/unjH6QVbTy7afrpm1taWBbtw2vzu09fyaZuBlnQt3QtkdC/dt/nIlQmrDkTVL0poWVY1fQswFLDYDAe///z9+esPhP3tByhgD5y7fenOs5NXHwLZv37/hevEl0iQFUHYyCIQAAC81FKn7MmyQgAAAABJRU5ErkJggg==","aspectRatio":1.900990099009901,"src":"/static/4e1070bbcb23f5e1f5c2c09ea738ae21/c4ecb/cover.png","srcSet":"/static/4e1070bbcb23f5e1f5c2c09ea738ae21/57ab0/cover.png 192w,\n/static/4e1070bbcb23f5e1f5c2c09ea738ae21/f4739/cover.png 384w,\n/static/4e1070bbcb23f5e1f5c2c09ea738ae21/c4ecb/cover.png 768w,\n/static/4e1070bbcb23f5e1f5c2c09ea738ae21/4eab0/cover.png 1152w,\n/static/4e1070bbcb23f5e1f5c2c09ea738ae21/73f08/cover.png 1200w","srcWebp":"/static/4e1070bbcb23f5e1f5c2c09ea738ae21/dd090/cover.webp","srcSetWebp":"/static/4e1070bbcb23f5e1f5c2c09ea738ae21/ae504/cover.webp 192w,\n/static/4e1070bbcb23f5e1f5c2c09ea738ae21/fef30/cover.webp 384w,\n/static/4e1070bbcb23f5e1f5c2c09ea738ae21/dd090/cover.webp 768w,\n/static/4e1070bbcb23f5e1f5c2c09ea738ae21/44170/cover.webp 1152w,\n/static/4e1070bbcb23f5e1f5c2c09ea738ae21/a7c53/cover.webp 1200w","sizes":"(max-width: 768px) 100vw, 768px","presentationWidth":768,"presentationHeight":403},"resize":{"src":"/static/4e1070bbcb23f5e1f5c2c09ea738ae21/c4ecb/cover.png"}}}},"fields":{"slug":"/2022-1-24-setup-ssl/"},"body":"var _excluded = [\"components\"];\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsxRuntime classic */\n\n/* @jsx mdx */\nvar _frontmatter = {\n  \"title\": \"Setting up SSL on Server\",\n  \"cover\": \"./cover.png\",\n  \"date\": \"2022-01-24T00:00:00.000Z\",\n  \"description\": \"We'll set up a SSL Certificate on the server with Let's Encrypt\",\n  \"tags\": [\"Nginx\", \"DigitalOCean\", \"SSL\", \"Let's Encrypt\", \"Ubuntu\"]\n};\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n      props = _objectWithoutProperties(_ref, _excluded);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"p\", null, \"Let's Encrypt is a Certificate Authority which allows you obtain and install free TLS/SSL certificates. Certbot from Let's Encrypt automates the whole process of obtaining and installing a certficate on your server running Nginx or Apache.\"), mdx(\"p\", null, \"This article assumes that you have a domain name for your server. If you do not have a domain name, you need to create a self-signed SSL certificate. Visit \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-nginx-in-ubuntu-16-04\"\n  }, \"here\"), \" to see how to add a self-signed SSL certificate on your server.\"), mdx(\"p\", null, \"Let's get started.\"), mdx(\"h3\", {\n    \"id\": \"install-certbot\"\n  }, \"Install Certbot\"), mdx(\"p\", null, \"Use the following command to install Certbot:\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\"\n  }, \"$ sudo apt install certbot python3-certbot-nginx\\n\")), mdx(\"h3\", {\n    \"id\": \"obtain-and-install-an-ssl-certificate\"\n  }, \"Obtain and Install an SSL Certificate\"), mdx(\"p\", null, \"Once Cerbot is installed, we can run the following command to obtain a SSL certificate for our server:\"), mdx(\"p\", null, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"NOTE: Replace example.com with your domain name\")), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\"\n  }, \"sudo certbot --nginx -d example.com -d www.example.com\\n\")), mdx(\"p\", null, \"Follow the steps in the prompt and agree to their terms of service. At the end of this, the certificate will be downloaded, installed, and loaded on your server. Your website should now be secured.\"), mdx(\"h3\", {\n    \"id\": \"verify-certbot-auto-renewal\"\n  }, \"Verify Certbot Auto-Renewal\"), mdx(\"p\", null, \"Let's Encrypt's certificates are valid for 90 days. We can use Certbot to automaically renew our certificates which are within 30 days of expiration.\"), mdx(\"p\", null, \"Certbot has a command for testing its certificate renewal process. By running this command, it will test its renewal process and it will also renew your certificates and reload Nginx to use the renewed certificates.\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\"\n  }, \"$ sudo certbot renew --dry-run\\n\")), mdx(\"h3\", {\n    \"id\": \"conclusion\"\n  }, \"Conclusion\"), mdx(\"p\", null, \"We set up a SSL Certificate on our server using Let's Encrypt. With Certbot, most of the processes were automated, which makes it very easy to install SSL certificates on your server.\"));\n}\n;\nMDXContent.isMDXComponent = true;"}},"pageContext":{"id":"c662d9bd-16a0-59d9-aaff-903dd8350216"}},"staticQueryHashes":["1961101537","2542493696"]}